$(document).ready(function(){
	var p=1;
	var $this=$('.slideBox');
	var pLen=$('.slideBox li').length;
	var pWidth=$(window).width()-10;
	if(pWidth>630){
		pWidth=630;
	}
	var tWidth=pWidth*pLen/2;
	$('.slideBox ul').css({width:tWidth});
	$('.slideBox li').each(function(){
		$(this).css({width:pWidth/2});	
	})
	
	$this.find('.controll-btn.next').on("tap",function(){
		p=p+1;
		if(p>=pLen){
			p=1;
		}
		goPage(p);
	})
	$this.find('.controll-btn.prev').on("tap",function(){
		p=p-1;
		if(p<=1){
			p=pLen;
		}
		goPage(p);
	})
	
	
	function goPage(p){
		if(p<pLen){
			$('.slideBox ul').animate({marginLeft:-(pWidth/2*(p-1))+'px'});
		}else{
			p=1;
			$('.slideBox ul').animate({marginLeft:'0'});
		}
	}
})



$(function(){
	sessionStorage.setItem('detailType','core');
})
$('.GreenHeader .btnBox a').on('tap',function(){
	var index=$(this).index();
	$('.GreenHeader .btnBox a').removeClass('active');
	$(this).addClass('active');
	$('.mainContent .page').hide();
	$('.mainContent .page').eq(index).show();
	mui('#offCanvasContentScroll').scroll().scrollTo(0,0,100);
})
$('.learn-about a.mui-btn').on('tap',function(){
	location.href=MPJ.base+"/pages/wine/learn-about.jsp";
})

$('#refine-one').change(function(){
	location.href=MPJ.base+"/pages/wine/wine-two-corner.jsp";
})
$('#sort-one').change(function(){
	location.href=MPJ.base+"/pages/wine/wine-two-corner.jsp";
})


$('#refine-two').change(function(){
	location.href=MPJ.base+"/pages/wine/wine-three-corner.jsp";
})
$('#sort-two').change(function(){
	location.href=MPJ.base+"/pages/wine/wine-three-corner.jsp";
})
$('#refine-three').change(function(){
	location.href=MPJ.base+"/pages/wine/wine-three-corner.jsp";
})
$('#sort-three').change(function(){
	location.href=MPJ.base+"/pages/wine/wine-three-corner.jsp";
})